package com.grupit.module.user.web.gwt.client.pluggablefeatures.ioc;

import org.ioc.commons.flowcontrol.actioncontroller.ActionController;
import org.ioc.commons.flowcontrol.actioncontroller.ActionHandler;
import org.ioc.commons.flowcontrol.eventbus.EventBus;
import org.ioc.commons.flowcontrol.operationmanager.OperationManager;

import com.grupit.api.core.common.util.GrupitReceiverAdapter;
import com.grupit.api.core.control.ioc.GrupitGlobalFlowController;
import com.grupit.api.core.control.presenter.GrupitAPIPresenter;
import com.grupit.domain.jdo.User;
import com.grupit.module.user.web.gwt.client.pluggablefeatures.ioc.NoteBoardView.Action;
import com.grupit.module.user.web.gwt.client.pluggablefeatures.ioc.NoteBoardView.Event;
import com.grupit.module.user.web.gwt.client.pluggablefeatures.ioc.NoteBoardView.Operation;

public class NoteBoardViewPresenter extends GrupitAPIPresenter<NoteBoardView, Event, Operation, Action> implements
		NoteBoardView.Presenter {

	public NoteBoardViewPresenter(NoteBoardView display, EventBus<Event> eventbus,
			OperationManager<Operation> operationManager, ActionController<Action> actionController) {
		super(display, eventbus, operationManager, actionController);
	}

	@Override
	public void onInitDisplay() {
		this.globalFlowController.actionController().bindAction(display, GrupitGlobalFlowController.Action.RefreshNow,
				new ActionHandler<GrupitGlobalFlowController.Action>() {

					@Override
					public void handleAction(Object sender, GrupitGlobalFlowController.Action action, Object... params) {
						display.poZitPanel().refresh();
					}
				});

	}

	@Override
	public void onCreatePoZit(int xBoardList, int yBoardList) {
		display.poZitPanel().createPoZit(xBoardList, yBoardList);
	}

}
